//
//  FMTxtViewController.m
//  WeEsion
//
//  Created by reylen on 15/12/21.
//  Copyright © 2015年 fdauto. All rights reserved.
//

#import "FMTxtViewController.h"

@interface FMTxtViewController ()

@property (retain, nonatomic) UITextView* textView;
@property (copy, nonatomic) NSString* filePath;

@end

@implementation FMTxtViewController



- (instancetype)initWithFilePath:(NSString *) filePath
{
    self = [super initWithNibName:nil bundle:nil];
    if (self) {
        self.filePath = filePath;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"Reader";
    
    self.textView = [[UITextView alloc]initWithFrame:self.view.bounds];
    self.textView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    self.textView.font = [UIFont systemFontOfSize:14];
    self.textView.textColor = [UIColor blackColor];
    self.textView.editable = NO;
    [self.view addSubview:self.textView];
    
    NSError*error = nil;
    NSString*content = [NSString stringWithContentsOfFile:_filePath encoding:NSUTF8StringEncoding error:&error];
    self.textView.text = content;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
